# !/usr/bin/python
# _*_ coding: utf-8 _*_
# @Time : 2021/5/25 2:39 下午
# @Author : liujun
# @File : my_exc.py
# @desc : 自定义异常

from schemas.response.result_code import ResultCode


class TokenAuthError(Exception):
    """
    用户身份验证失败
    """
    def __init__(self):
        result_code = ResultCode.TOKEN_AUTH_ERROR
        self.result_code = result_code


class TokenExpired(Exception):
    """
    用户身份过期
    """
    def __init__(self):
        result_code = ResultCode.TOKEN_EXPIRED
        self.result_code = result_code


class UserNotExist(Exception):
    """
    账号不存在
    """
    def __init__(self):
        result_code = ResultCode.USER_NOT_EXIST
        self.result_code = result_code


class UserAccountForbidden(Exception):
    """
    该用户已禁用，请联系管理员
    """
    def __init__(self):
        result_code = ResultCode.USER_ACCOUNT_FORBIDDEN
        self.result_code = result_code


class UserLoginError(Exception):
    """
    密码错误
    """
    def __init__(self):
        result_code = ResultCode.USER_LOGIN_ERROR
        self.result_code = result_code


class UserHasExisted(Exception):
    """
    用户已存在
    """
    def __init__(self):
        result_code = ResultCode.USER_HAS_EXISTED
        self.result_code = result_code


class AuthenticationError(Exception):
    """
    无访问权限
    """
    def __init__(self):
        result_code = ResultCode.AUTHENTICATION_ERROR
        self.result_code = result_code


class UserNotLoggedIn(Exception):
    """
    用户未登录
    """
    def __init__(self):
        result_code = ResultCode.USER_NOT_LOGGED_IN
        self.result_code = result_code


class DataNone(Exception):
    """
    数据未找到
    """
    def __init__(self):
        result_code = ResultCode.DATA_NONE
        self.result_code = result_code


class DataAlreadyExisted(Exception):
    """
    数据已存在
    """
    def __init__(self):
        result_code = ResultCode.DATA_ALREADY_EXISTED
        self.result_code = result_code


class ValidationError(Exception):
    """
    参数验证错误
    """
    def __init__(self):
        result_code = ResultCode.VALIDATION_ERROR
        self.result_code = result_code


class RequestValidationError(Exception):
    """
    请求参数错误
    """
    def __init__(self):
        result_code = ResultCode.REQUEST_VALIDATION_ERROR
        self.result_code = result_code


class SystemInnerError(Exception):
    """
    内部错误，请稍后重试
    """
    def __init__(self):
        result_code = ResultCode.SYSTEM_INNER_ERROR
        self.result_code = result_code
